package com.tjsinfo.tjsoa.addresslist.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tjsinfo.tjsoa.addresslist.bo.IAddressListUserBo;
import com.tjsinfo.tjsoa.addresslist.vo.AddressListUser;

public class toAddressListUserAction extends Action{
	private IAddressListUserBo userBo;
	public void setUserBo(IAddressListUserBo userBo) {
		this.userBo = userBo;
	}
	
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		
		String user_id = request.getParameter("user_id");
		String type = request.getParameter("type");
		String moduleType = request.getParameter("moduleType");
		String intpage = request.getParameter("intpage");
		AddressListUser listUser = userBo.getAddresssListUserById(user_id);
		
		request.setAttribute("listUser", listUser);
		request.setAttribute("intpage", intpage);
		request.setAttribute("type", type);
		request.setAttribute("moduleType", moduleType);
		if (listUser.getAddressListGroup()!=null) {
			request.setAttribute("maxSort", userBo.getMaxUserSort(listUser.getAddressListGroup().getId().toString()));
		}
		return mapping.findForward(type);
	}
}
